﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MC_AI_002
{
    class Program
    {
        static void Main(string[] args)
        {
            OperationTimer.initialize();

            List<int> tc = new List<int>();
            
            tc.Add(Environment.TickCount);

            TrackManager tman = new TrackManager();

            OperationTimer.Start();
            for (int i = 0; i < 5; i++)
            {
                
                tman.addTrack(new float[] { (float)(i), 0, 0 }, new float[] { 0, 0, 0 });
                
            }
            OperationTimer.End();
            //OperationTimer.flush();

            OperationTimer.Start();
            for (int i = 0; i < 5; i++)
            {
                
                tman.addTrack(new float[] { (float)(i), 2, 0 }, new float[] { 0, 0, 0 });
                
            }
            OperationTimer.End();
            //OperationTimer.flush();

            OperationTimer.Start();
            for (int i = 0; i < 5; i++)
            {
                
                tman.addTrack(new float[] { -1, (float)(i), 0 }, new float[] { 0, 0, 0 });
                
            }
            OperationTimer.End();
            //OperationTimer.flush();

            /* Track as it looks like now
             *   -1 0 1 2 3 4 5 6 7 8 9
             * 9  x
             * 8  x
             * 7  x
             * 6  x
             * 5  x
             * 4  x
             * 3  x
             * 2  x x x x x x
             * 1  x
             * 0  x x x x x x x x x x x
             */
            tc.Add( Environment.TickCount);

            //tman.printItems(true, true);
            
            //tc_start = Environment.TickCount;
            OperationTimer.Start();
            tman.removeTrack(12);
            OperationTimer.End();

            tc.Add( Environment.TickCount);

            tman.printItems(true, true);

            List<int> sub = new List<int>();
            for (int t = 1; t < tc.Count; t++)
            {
                sub.Add(tc.ElementAt(t) - tc.ElementAt(t - 1));
            }

            foreach (int t in sub)
            {
                Console.WriteLine("Elapsed time in ms: {0}", t);
            }
            
            //tman.removeTrack(12); // attempt to remove again to test failure to find: SUCCESSFUL
            Console.ReadKey();

            OperationTimer.flush();
            
            Console.ReadKey();
            
        }
    }
}
